# Maintainer: Some One <some.one@some.email.com>
#This value is here because some python package names have capital letters
#while there is a strong preference for lowercase letters in ArchLinux and
#MSYS packages.

_realname=tempita
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.5.3dev20170202
_commit=47414a7c6e46a9a9afe78f0bce2ea299fa84d10d
pkgrel=1
pkgdesc="A lightweight unicode templating language (mingw-w64)"
arch=('any')
url='https://github.com/gjhiggins/tempita'
license=('custom:MIT')
validpgpkeys=('gpg_KEY')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=('git'
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs' 'strip' '!debug')
source=("${_realname}::git://github.com/gjhiggins/tempita.git#commit=${_commit}")
sha256sums=('SKIP')

prepare() {
  cd "${srcdir}"
  rm -rf "python-build-${CARCH}" | true
  cp -r "${_realname}" "python-build-${CARCH}"

  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py test
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
